<?php

namespace app\customer\controller;
use app\common\controller\DBase;
use app\common\controller\PCBase;
use  app\customer\logic\TikMessageLogic;
use  think\App;

class Conversations extends PCBase
{

    protected $tikMessageLogic = null;
    public function __construct(App $app,TikMessageLogic $tikMessageLogic)
    {
        parent::__construct($app);
        $this->tikMessageLogic = $tikMessageLogic;
    }


    /**
     * @desc   店铺发送消息管理
     * @author luckyXiong
     * @date   2024-04-29
     */
    public function index(){
        $data  = $this->request->post();
        return $this->tikMessageLogic->get_conversation_list($data);

    }



    /**
     * @desc   消息会话IM
     * @author luckyXiong
     * @date   2024-05-20
     */
    public function getImList(){
        $data  = $this->request->post();
        $res   = $this->tikMessageLogic->get_im_list($data);
        return $this->jsonMessage(200,'true','获取成功',$res);
    }


    /**
     * @desc   消息会话IM
     * @author luckyXiong
     * @date   2024-05-20
     */
    public function getImInfo(){
        $data  = $this->request->post();
        $res   = $this->tikMessageLogic->get_im_info($data);
        return $this->jsonMessage(200,'true','获取成功',$res);
    }


    /**
     * @desc   消息会话IM
     * @author luckyXiong
     * @date   2024-05-20
     */
    public function uploadImage(){
        $file  = $this->request->file('file');
        $data['file'] = $file;
        $res   = $this->tikMessageLogic->uploadImages($data);
        return $this->jsonMessage(200,'true','操作成功',$res);
    }


    /**
     * @desc   发送文本消息
     * @author luckyXiong
     * @date   2024-05-20
     */
    public function sendText(){
        $data  = $this->request->post();
        $res   = $this->tikMessageLogic->sendText($data);
        return $this->jsonMessage(200,'true','操作成功',$res);
    }




    /**
     * @desc   消息变更为已读
     * @author xx
     * @date   2024-05-19
     */
    public function messagesReadOperate($params=[])
    {
        $data   = $this->request->post();
        $res    = $this->tikMessageLogic->messages_read_operate($data);
        return $this->jsonMessage(200, true, "操作成功!",$res);
    }





    /**
     * @desc   发送图片消息
     * @author luckyXiong
     * @date   2024-05-20
     */
    public function sendImage(){
        $data  = $this->request->post();
        $res   = $this->tikMessageLogic->sendImage($data);
        return $this->jsonMessage(200,'true','操作成功',$res);
    }


    /**
     * @desc   获取订单详情sku数据
     * @author luckyXiong
     * @date   2024-05-29
     */
    public function getSkuInfo(){
        $data  = $this->request->post();
        $res   = $this->tikMessageLogic->getSkuInfo($data);
        return $this->jsonMessage(200,'true','获取成功',$res);
    }


    /**
     * @desc   获取订单track
     * @author luckyXiong
     * @date   2024-05-29
     */
    public function getTrackInfo(){
        $data  = $this->request->post();
        $res   = $this->tikMessageLogic->getTrackInfo($data);
        return $this->jsonMessage(200,'true','获取成功',$res);
    }






















}